// import React from 'react'
import { RouterProvider, createHashRouter } from "react-router-dom";
import ReactDOM from "react-dom/client";
import App from "./App.jsx";
import "./index.scss";
import Home from "./pages/home";
import User from "./pages/user";
import Login from "./pages/login";
import Reg from "./pages/reg";
import Yaopin from "./pages/yaopin";
import Microsurgery from "./pages/Microsurgery.jsx";
import WzDetail from "./pages/wzdetail.jsx";
import WzDesc from "./pages/wzdesc.jsx";
import ProtectedRoute from "./components/Protected-route.jsx";
import YaoDetail from "./pages/yaoDetail.jsx";
import Xiangqing from "./components/xiangqing.jsx";
import Xsxiangqing from "./components/xsxiangqing.jsx";
import Cart from "./pages/cart.jsx";
import Address from "./components/address.jsx";
import Xiugai from "./components/xiugai.jsx";
import Repassword from "./components/repassword.jsx";
import Wodeguznhu from "./components/wodeguznhu.jsx";

const router = createHashRouter([
  {
    path: "login",
    element: <Login />,
  },
  {
    path: "reg",
    element: <Reg />,
  },
  {
    path: "/",
    element: <App />,
    children: [
      {
        index: true,
        element: <Home />,
      },
      {
        path: "/:id",
        element: <Xiangqing></Xiangqing>,
      },
      {
        path: "doctor/:id",
        element: <Xsxiangqing></Xsxiangqing>,
      },
      {
        path: "Microsurgery",
        element: <Microsurgery />,
      },

      {
        path: "Microsurgery/:id",
        element: <Microsurgery />,
      },
      {
        path: "WzDetail",
        element: <WzDetail />,
      },
      {
        path: "WzDetail/:id",
        element: <WzDetail />,
      },
      {
        path: "WzDesc/:id",
        element: <WzDesc />,
      },
      {
        path: "Address",
        element: <Address></Address>,
      },
      {
        path: "xiugai",
        element: <Xiugai></Xiugai>,
      },
      {
        path: "repassword",
        element: <Repassword></Repassword>,
      },
      {
        path: "wodeguanzhu",
        element: <Wodeguznhu></Wodeguznhu>,
      },
      {
        path: "user",
        element: (
          <ProtectedRoute>
            <User />
          </ProtectedRoute>
        ),
      },
      {
        path: "yaopin",
        element: <Yaopin />,
      },
      {
        path: "yaopin/:id",
        element: <YaoDetail />,
      },
      {
        path: "cart",
        element: <Cart />,
      },
    ],
  },
]);

ReactDOM.createRoot(document.getElementById("root")).render(
  <RouterProvider router={router}></RouterProvider>
);
